const express =require('express')
const router =express.Router()
module.exports =router

const db = require('../db')
const {formatDate} = require('../utils/utils')

// 实现检测用户名是否存在接口check    GET /api/user/check
router.get('/check',(req,res)=>{
    const {username}=req.query;
    const result = await db.reg(username)
    if(result){
        res.send(formatData({msg:'user is exist'}))
    }else{
        res.send(formatData.success())
    }
})